# Through the Grapevine: Informational Consequences of Interpersonal Political Communication
# Replication Code
# Taylor N. Carlson
# December 2018

rm(list=ls())

# --- Load Packages --- #

library(stargazer) 
library(xtable)
library(irr)
library(quanteda)
library(syuzhet)


# --- Study 1 --- #

setwd("/Users/Taylor/Dropbox/Consequences of Social Information/APSR Submission/APSR R&R/APSR Replication Materials/Carlson_Grapevine_Replication_Materials/")

news <- read.csv("grapevine_news.csv") 
  # Each row is a news article about the BEA report
  # Row 1 is the BEA report
soc <- read.csv("grapevine_study1_121318.csv")
  # Data from Study 1 (generating the social messages)
  # Each row is a respondent, with the exception of Row 1, which just includes the text of the Reuters article which participants read

# Intercoder reliability footnote:
coder1 <- soc$units.total1
coder2 <- soc$units.total2
irr.matrix <- as.matrix(cbind(coder1, coder2))

kripp.alpha(t(irr.matrix), method="ratio") # alpha=.78
cor.test(soc$units.total1, soc$units.total2) # r=.91


# Lengths reported in text
mean(news$wordcount[-1]) # word count of news articles, remove first row because first row is the original BEA report
news$wordcount[1] # word count of official report

# Lengths of social messages
mean(soc$wordcount[-1]) # 37.3

round((mean(soc$wordcount, na.rm=T)/news$wordcount[1])*100, digits=2)

# Differences based on partisanship of recipient

t.test(soc$wordcount[soc$pid7<4], soc$wordcount[soc$pid7==4]) # democrats vs. independents, ns
t.test(soc$wordcount[soc$pid7<4], soc$wordcount[soc$pid7>4]) # democrats vs. republicans, ns
t.test(soc$wordcount[soc$pid7>4], soc$wordcount[soc$pid7==4]) # republicans vs. independents, ns

# Similarity 

## Similarity between news articles and official report 
  # official report text is in the first row of the dataset

myDfm <- dfm(as.character(news$text), verbose=FALSE)
cosinesim <- textstat_simil(x=myDfm, selection=docnames(myDfm[1]), margin="documents", method="cosine")
cosinemat <- as.matrix(cosinesim)

news$similarity <- NA
for(i in 1:length(cosinemat)){
  news$similarity[i] <- cosinemat[i]
}

## Similarity between social messages and news article 
  # news article text is in the first row of the dataset
myDfm <- dfm(as.character(soc$message), verbose=FALSE)
cosinesim <- textstat_simil(x=myDfm, selection=docnames(myDfm[1]), margin="documents", method="cosine")
cosinemat <- as.matrix(cosinesim)

soc$similarity <- NA
for(i in 1:length(cosinemat)){
  soc$similarity[i] <- cosinemat[i]
}

summary(soc$similarity[-1])
  # mean=.460, median=.468
summary(news$similarity[-1])
  # mean=.6989, median=.7532
  # Reuters article (row 2) = .775 (.78)
  news$similarity[2]

# Table 1 Examples

soc$message[soc$similarity==min(soc$similarity)]
  # While I ******* hate Donald Trump it seems that he is actually doing some good. He is still a moron but he appears to be getting numbers up so thats something
  # .102

soc$message[soc$similarity==median(soc$similarity)]
  # The Trump administration has still not been able to get going their plan to raise the U.S. growth by 3\\% and it's already been 6 months.
  # Note that this median was calculated including the news article as the highest value. Including the news article (similarity=1), the median is .4684, excluding it properly yields a median of .4676
  # However, excluding the news article leaves 402 observations, leaving two options for an example of the median message
  # .4683

soc$message[soc$similarity==max(soc$similarity[-1])]
  # You know, the most recent reporting on the U.S. economy showed a bit of an improvement owing to some unexpectedly moderate rise in consumer psending \\& a bigger jump in exports. This also included a nice showing on Gross domestic product according to the Commerce Department final assessment on prior first quarter estimates, as Thursday's reporting says. A sustained average of 3 percent growth has not been seen since the 1990s. Since 2000, the U.S. economy has grown at an average 2 percent rate. The Trump administration's stated that it is still expecting a target of swiftly boosting U.S. growth to 3 percent. We shall see how things develop going foreword, given President Donald Trump's economic program of tax cuts, regulatory rollbacks, and infrastructure spending.
  # .7651
## Double check these visually 
View(soc[, c("message", "similarity")])
  
## Figure 1

par(mfrow=c(1,1))
plot(density(news$similarity[-1], na.rm=T), main="Cosine Similarity Distribution\nOfficial Report, News Articles, and Social Messages", xlab="Cosine Similarity Score\n1=Most Similar", lwd=2, lty=1, xlim=c(0,1), cex.main=.75)
lines(density(soc$similarity[-1]), lwd=2, lty=2)
legend(-.15,4, legend=c("News Articles vs. Official Report", "Social Messages vs. Reuters Article"), seg.len=.5, x.intersp=.25, lty=c(1,2), lwd=2, cex=.75, bty="n")

## The similarity scores between the socially generated messages and the Reuters article were significantly lower than the similarity scores between the news articles and the BEA report 

t.test(soc$similarity[-1], news$similarity[-1])
  # p<.001

# Sentiment 

## Most positive and negative message examples for Table 1

summary(soc$against.econ[-1]) # maximum number of negative statements about the economy was 4 (avg of two coders)
summary(soc$favor.econ[-1]) # maximum number of positive statements about the economy was 5.5 (avg of two coders)


## Here we use hand-coded data from two independent coders. The average of their scores is used. Please see appendix for coding protocol details.

soc$favor.econ <- NA
soc$favor.econ <- (soc$favor.econ1+soc$favor.econ2)/2

soc$favor.rep <- NA
soc$favor.rep <- (soc$favor.rep1 + soc$favor.rep2)/2

soc$favor.dem <- NA
soc$favor.dem <- (soc$favor.dem1 + soc$favor.dem2)/2

soc$against.econ <- NA
soc$against.econ <- (soc$against.econ1 + soc$against.econ2)/2

soc$against.rep <- NA
soc$against.rep <- (soc$against.rep1 + soc$against.rep2)/2

soc$against.dem <- NA
soc$against.dem <- (soc$against.dem1 + soc$against.dem2)/2

soc$units.econ <- NA
soc$units.econ <- (soc$units.econ1 + soc$units.econ2)/2

soc$units.dem <- NA
soc$units.dem <- (soc$units.dem1 + soc$units.dem2)/2

soc$units.rep <- NA 
soc$units.rep <- (soc$units.rep1 + soc$units.rep2)/2

soc$units.total <- NA
soc$units.total <- (soc$units.total1 + soc$units.total2)/2

soc$wronginfo <- NA
soc$wronginfo <- (soc$wronginfo1 + soc$wronginfo2)/2

## 24% of the information contained in a social message was positive about the economy, whereas 14.3% of the information in a social message was negative about the economy.

### Positive
soc$pct.favor.econ <- NA
soc$pct.favor.econ <- soc$favor.econ/soc$units.total
mean(soc$pct.favor.econ[-1], na.rm=T) # 24.3%

### Negative
soc$pct.against.econ <- NA
soc$pct.against.econ <- soc$against.econ/soc$units.total
mean(soc$pct.against.econ[-1], na.rm=T) # 14.2%

## The social messages also contained significantly less negative information than the article, which contained 17.7% negative economic information (p<.001).
soc$pct.against.econ[1] # 17.7%

t.test(soc$pct.against.econ[-1], mu=soc$pct.against.econ[1])

## Republicans transmitted significantly more positive information about the economy (p<.01), while Democrats transmitted significantly more negative information about the economy (p<.05).

### Republicans transmit more positive information than democrats
t.test(soc$pct.favor.econ[soc$pid7.sender>4], soc$pct.favor.econ[soc$pid7.sender<4])

### Republicans transmit more positive information than negative information 
t.test(soc$pct.favor.econ[soc$pid7.sender>4], soc$pct.against.econ[soc$pid7.sender>4])

### Democrats transmit more negative information than republicans 
t.test(soc$pct.against.econ[soc$pid7.sender<4], soc$pct.against.econ[soc$pid7.sender>4])

### *Suggestive* Democrats transmit more positive information than negative information 
t.test(soc$pct.against.econ[soc$pid7.sender<4], soc$pct.favor.econ[soc$pid7.sender<4])
  # suggestive that Democrats still send more positive information than negative information (p<.10)

## Republicans transmitted significantly less negative information than the Reuters article (p<.001). 

### Democrats send less positive information than the Reuters article 
t.test(soc$pct.against.econ[soc$pid7.sender>4], mu=soc$pct.against.econ[1])

## Sentiment dictionaries 

# Hu & Liu
soc$sentiment.bing <- NA
soc$sentiment.bing <- get_sentiment(as.character(soc$message), method="bing")

# AFinn
soc$sentiment.afinn <- NA
soc$sentiment.afinn <- get_sentiment(as.character(soc$message), method="afinn")

# Mohammad
soc$sentiment.nrc <- NA
soc$sentiment.nrc <- get_sentiment(as.character(soc$message), method="nrc")

# --- Study 2 --- # 

rm(list=ls())

d <- read.csv("grapevine_study2.csv")

# Demographics
summary(d$age) # 18-89, mean=48
prop.table(table(d$female)) #50.4% female, 49.6% male
prop.table(table(d$race)) # 61.8% white, 13.5% black, 10.7% asian, 10.1% latino, 4.0% other
sum(prop.table(table(d$pid7))[1:3]) # 39.6% democrats
sum(prop.table(table(d$pid7))[5:7]) # 39.2% republicans
prop.table(table(d$pid7))[4] # 21.1% independents 

# Table 2

# Compare pre to post treatment knowledge questions
prop.test(x=c(table(d$econgrew.pre.correct)["1"], table(d$econgrew.post.correct)["1"]), n=c(sum(table(d$econgrew.pre.correct)), sum(table(d$econgrew.post.correct)))) 
  #ns, pre=.7304, post=.7344

prop.test(x=c(table(d$gdpgrew.pre.correct)["1"], table(d$gdpgrew.post.correct)["1"]), n=c(sum(table(d$gdpgrew.pre.correct)), sum(table(d$gdpgrew.post.correct)))) 
  #p<.01, pre=.505, post=.570

prop.test(x=c(table(d$gdpjanmarch.pre.correct)["1"], table(d$gdpjanmarch.post.correct)["1"]), n=c(sum(table(d$gdpjanmarch.pre.correct)), sum(table(d$gdpjanmarch.post.correct)))) 
  #ns, pre=.542, post=.5464

prop.test(x=c(table(d$trumptarget.pre.correct)["1"], table(d$trumptarget.post.correct)["1"]), n=c(sum(table(d$trumptarget.pre.correct)), sum(table(d$trumptarget.post.correct)))) 
  #p<.01, pre=.5996, post=.6687

prop.test(x=c(table(d$avgrate.pre.correct)["1"], table(d$avgrate.post.correct)["1"]), n=c(sum(table(d$avgrate.pre.correct)), sum(table(d$avgrate.post.correct)))) 
  #p=.055, pre=.4394, post=.4831

prop.test(x=c(table(d$conspending.pre.correct)["1"], table(d$conspending.post.correct)["1"]), n=c(sum(table(d$conspending.pre.correct)), sum(table(d$conspending.post.correct)))) 
  #ns, pre=.536, post=.54

# Compare pre and post treatment responses to .5 (better than chance?)

prop.test(x=table(d$econgrew.pre.correct)["1"], sum(table(d$econgrew.pre.correct)), p=0.5) 
  #p<.001

prop.test(x=table(d$econgrew.post.correct)["1"], n=sum(table(d$econgrew.post.correct)), p=0.5) 
  #p<.001

prop.test(x=table(d$gdpgrew.pre.correct)["1"], sum(table(d$gdpgrew.pre.correct)), p=0.5) 
  #ns

prop.test(x=table(d$gdpgrew.post.correct)["1"], n=sum(table(d$gdpgrew.post.correct)), p=0.5) 
  #p<.001

prop.test(x=table(d$gdpjanmarch.pre.correct)["1"], sum(table(d$gdpjanmarch.pre.correct)), p=0.5) 
  #p<.05

prop.test(x=table(d$gdpjanmarch.post.correct)["1"], n=sum(table(d$gdpjanmarch.post.correct)), p=0.5) 
  #p<.01

prop.test(x=table(d$trumptarget.pre.correct)["1"], sum(table(d$trumptarget.pre.correct)), p=0.5) 
  #p<.001

prop.test(x=table(d$trumptarget.post.correct)["1"], n=sum(table(d$trumptarget.post.correct)), p=0.5) 
  #p<.001

prop.test(x=table(d$avgrate.pre.correct)["1"], sum(table(d$avgrate.pre.correct)), p=0.5) 
  #p<.001 WORSE THAN CHANCE

prop.test(x=table(d$avgrate.post.correct)["1"], n=sum(table(d$avgrate.post.correct)), p=0.5) 
  #ns

prop.test(x=table(d$conspending.pre.correct)["1"], sum(table(d$conspending.pre.correct)), p=0.5) 
  #p<.05

prop.test(x=table(d$conspending.post.correct)["1"], n=sum(table(d$conspending.post.correct)), p=0.5) 
  #p<.05

## Learning by Treatment Group

d$ideal.informant <- NA
d$ideal.informant[d$copartisan.sender==1 & d$knowledgeable.sender==1] <- 1
d$ideal.informant[d$copartisan.sender==0 & d$knowledgeable.sender==0] <- 0
d$ideal.informant[d$copartisan.sender==1 & d$knowledgeable.sender==0] <- 0
d$ideal.informant[d$copartisan.sender==0 & d$knowledgeable.sender==1] <- 0
table(d$ideal.informant)

### Figure 2

# Calculate the average change in correct answers (post-pre) in each treatment group
infochange.means <- c(mean(d$correct.change[d$ideal.informant==0], na.rm=T),
                      mean(d$correct.change[d$ideal.informant==1], na.rm=T),
                      mean(d$correct.change[d$treatment=="media"], na.rm=T))
infochange.mat <- matrix(NA, nrow=3, ncol=2)
infochange.mat[,1] <- c(1,2,3)
infochange.mat[,2] <- infochange.means

infochange.se <- c(sd(d$correct.change[d$ideal.informant==0], na.rm=T)/sqrt(table(d$ideal.informant)[1]),
                   sd(d$correct.change[d$ideal.informant==1], na.rm=T)/sqrt(table(d$ideal.informant)[2]),
                   sd(d$correct.change[d$treatment=="media"], na.rm=T)/sqrt(table(d$treatment)[1]))

labs <- c("Non-Ideal\nInformant", "Ideal\nInformant", "Media")
x <- 1:3
par(mar=c(5,6,4,2)+.1)
plot(infochange.means, x, main="Information Recall by Treatment Group",
     xlim=c(-1,1), xlab="Change in Recall (Post - Pre)", ylab="",
     axes=FALSE,
     pch=19)
axis(1)
axis(2, at=1:length(labs), las=1, labels=labs)
arrows(infochange.means-1.96*infochange.se, x, infochange.means+1.96*infochange.se, x, angle=90, code=.5)
abline(v=0)
text(.55,1.05,"More Correct Recall Post-Treatment", cex=.75)
text(-.55,1.05,"Less Correct Recall Post-Treatment", cex=.75)
box()

### Participants in the media condition answered more questions correctly than those in the social condition

t.test(d$correct.change[d$treatment=="media"], d$correct.change[d$treatment!="media"])
  # media mean=.3966
  # social mean=.1374
  # p=.01573

### Participants in the media condition answered more questions correctly after exposure to information (within subject)

t.test(d$correct.pre[d$treatment=="media"], d$correct.post[d$treatment=="media"])
  # pre: 3.36
  # post: 3.76
  # p<.001
  # increase of about .4 of a question

### Participants in the social condition answered more questions correctly after exposure to information (within subject)

t.test(d$correct.pre[d$treatment!="media"], d$correct.post[d$treatment!="media"])
  # pre: 3.33
  # post: 3.47
  # p<.05

### Participants who received information from an ideal informant learned significantly more than participants who received information from a non-ideal informant 

#### Ideal informant vs. Non-ideal informant 
t.test(d$correct.change ~ d$ideal.informant)
  # p<.05, ideal informant=.3605, non-ideal informant=.0887

#### Ideal informant vs. media
t.test(d$correct.change[d$ideal.informant==1], d$correct.change[d$treatment=="media"])
  # ns, media=.3966, ideal informant=.3605

### Remove participants who answered all 6 questions at baseline correctly 

#### Ideal informant vs. Non-ideal informant 
t.test(d$correct.change[d$correct.pre<6] ~ d$ideal.informant[d$correct.pre<6])
# p=.052, ideal informant=.3605, non-ideal informant=.1325

#### Ideal informant vs. media
t.test(d$correct.change[d$correct.pre<6 & d$ideal.informant==1], d$correct.change[d$correct.pre<6 & d$treatment=="media"])
# ns, media=.4397, ideal informant=.3605

# Knowledge or Copartisanship?

## What were participants trying to accomplish with their messages?
prop.table(table(d$motivation.sender[!duplicated(d$message)]))*100
  # 74.4% objectively inform
  # 21.6% persuade 
  # 2.24% mobilize
  # 1.7% mislead 

## Were more knowledgeable informants more likely to report trying to objectively inform?

prop.table(table(d$motivation.sender, d$knowledgeable.sender), 2)
prop.test(x=c(table(d$motivation.sender, d$knowledgeable.sender)[1,1], table(d$motivation.sender, d$knowledgeable.sender)[1,2]),
          n=c(sum(table(d$motivation.sender, d$knowledgeable.sender)[,1]), sum(table(d$motivation.sender, d$knowledgeable.sender)[,2])))
  # ns

## Were copartisan informants more likely to report trying to objectively inform? 

prop.table(table(d$motivation.sender, d$copartisan.sender), 2)
prop.test(x=c(table(d$motivation.sender, d$copartisan.sender)[1,1], table(d$motivation.sender, d$copartisan.sender)[1,2]),
          n=c(sum(table(d$motivation.sender, d$copartisan.sender)[,1]), sum(table(d$motivation.sender, d$copartisan.sender)[,2])))
  # p<.01
  # 71.5% of outpartisans, 80.9% of copartisans

## Knowledge vs. Copartisanship 
t.test(d$correct.change ~ d$knowledgeable.sender)
  # p<.001
  # mean for less knowledgeable=-.33
  # mean for more knowledgeable=.46

t.test(d$correct.change ~ d$copartisan.sender)
  # p=.1919 (ns)
  # mean for out-partisan=.18
  # mean for copartisan=.056

# Evaluations

## Economic Evaluations 

### Perceptions of partisan bias in informational treatments

#### Media treatment was perceived as relatively neutral with a slight Democratic bias

mean(d$articlebias[d$treatment=="media"], na.rm=T) # 3.78 on 7 point scale where 1 is "strongly favors Democrats," 4 is neutral, and 7 is "strongly favors Republicans"

#### Democratic messages more biased toward Democrats than news article 

mean(d$messagebias[d$treatment=="socialdem"], na.rm=T) # 3.58
t.test(d$messagebias[d$treatment=="socialdem"], d$articlebias[d$treatment=="media"]) # p=.0429

#### Independent messages were perceived to have the same bias as the news article

t.test(d$messagebias[d$treatment=="socialind"], d$articlebias[d$treatment=="media"]) # p=.6778

#### Republican messages were perceived to favor Republcians more than the news article and Democrat messages

t.test(d$messagebias[d$treatment=="socialrep"], d$articlebias[d$treatment=="media"]) # p=.04498
t.test(d$messagebias[d$treatment=="socialrep"], d$messagebias[d$treatment=="socialdem"]) # p<.01

### Figure 3

econindex.means <- c(mean(d$econindex.change[d$ideal.informant==0], na.rm=T),
                     mean(d$econindex.change[d$ideal.informant==1], na.rm=T),
                     mean(d$econindex.change[d$treatment=="media"], na.rm=T),
                     mean(d$econindex.change[d$treatment=="socialdem"], na.rm=T),
                     mean(d$econindex.change[d$treatment=="socialind"], na.rm=T),
                     mean(d$econindex.change[d$treatment=="socialrep"], na.rm=T))

econindex.se <- c(sd(d$econindex.change[d$ideal.informant==0], na.rm=T)/sqrt(sum(table(d$ideal.informant, d$econindex.change)[1,])),
                  sd(d$econindex.change[d$ideal.informant==1], na.rm=T)/sqrt(sum(table(d$ideal.informant, d$econindex.change)[2,])),
                  sd(d$econindex.change[d$treatment=="media"], na.rm=T)/sqrt(sum(table(d$treatment, d$econindex.change)[1,])),
                  sd(d$econindex.change[d$treatment=="socialdem"], na.rm=T)/sqrt(sum(table(d$treatment, d$econindex.change)[2,])),
                  sd(d$econindex.change[d$treatment=="socialind"], na.rm=T)/sqrt(sum(table(d$treatment, d$econindex.change)[3,])),
                  sd(d$econindex.change[d$treatment=="socialrep"], na.rm=T)/sqrt(sum(table(d$treatment, d$econindex.change)[4,])))

x <- 1:4
par(mfrow=c(1,1))
par(mar=c(5,6,4,2)+.1)
plot(econindex.means[3:6], x, main="Change in Economic Confidence Index",
     xlim=c(-.25,.25), xlab="Change in Economic Confidence Index (Post - Pre)", ylab="",
     pch=19,
     axes=FALSE)
axis(1)
axis(2, at=c(1,2,3,4), las=1, labels=c("Media", "Democrat\nInformant", "Independent\nInformant", "Republican\nInformant"))
arrows(econindex.means[3:6]-1.96*econindex.se[3:6], x, econindex.means[3:6]+1.96*econindex.se[3:6], x, angle=90, code=.5)
abline(v=0)
box()

## Presidential Approval 

### Trump handling the economy 

t.test(d$trumpeconapprove.change2[d$treatment=="media"], d$trumpeconapprove.change2[d$treatment=="socialdem"]) #ns
t.test(d$trumpeconapprove.change2[d$treatment=="media"], d$trumpeconapprove.change2[d$treatment=="socialrep"]) #p<.10 rep more positive than media
t.test(d$trumpeconapprove.change2[d$treatment=="media"], d$trumpeconapprove.change2[d$treatment=="socialind"]) #ns
t.test(d$trumpeconapprove.change2[d$treatment=="socialind"], d$trumpeconapprove.change2[d$treatment=="socialdem"]) #ns
t.test(d$trumpeconapprove.change2[d$treatment=="socialrep"], d$trumpeconapprove.change2[d$treatment=="socialdem"]) #ns

t.test(d$trumpeconapprove.change2[d$treatment=="media"], mu=0) # p=.03, more negative
t.test(d$trumpeconapprove.change2[d$treatment=="socialrep"], mu=0) # ns
t.test(d$trumpeconapprove.change2[d$treatment=="socialdem"], mu=0) # ns
t.test(d$trumpeconapprove.change2[d$treatment=="socialind"], mu=0) # ns
t.test(d$trumpeconapprove.change2[d$ideal.informant==0], mu=0) # ns (non-ideal informant)
t.test(d$trumpeconapprove.change2[d$ideal.informant==1], mu=0) #p=.275 (ideal informant)


### Approval of Trump Handling His Job as President

t.test(d$trumpapprove.change2[d$treatment=="media"], d$trumpapprove.change2[d$treatment=="socialdem"]) #ns
t.test(d$trumpapprove.change2[d$treatment=="media"], d$trumpapprove.change2[d$treatment=="socialrep"]) #ns
t.test(d$trumpapprove.change2[d$treatment=="media"], d$trumpapprove.change2[d$treatment=="socialind"]) #ns
t.test(d$trumpapprove.change2[d$treatment=="socialind"], d$trumpapprove.change2[d$treatment=="socialdem"]) #p<.10
t.test(d$trumpapprove.change2[d$treatment=="socialrep"], d$trumpapprove.change2[d$treatment=="socialdem"]) #p<.05 Those exposed to a message from a Republican had significantly more positive evaluations of Trump than those who received a message from a Democrat (p<.05). 

t.test(d$trumpapprove.change2[d$treatment=="media"], mu=0) #ns
t.test(d$trumpapprove.change2[d$treatment=="socialrep"], mu=0) #p<.05
t.test(d$trumpapprove.change2[d$treatment=="socialdem"], mu=0) #ns
t.test(d$trumpapprove.change2[d$treatment=="socialind"], mu=0) #p=.04096
t.test(d$trumpapprove.change2[d$ideal.informant==0], mu=0) #p=.06683 (non-ideal informant)
t.test(d$trumpapprove.change2[d$ideal.informant==1], mu=0) #p=.1091 (ideal informant)

#### Democrats updated their beliefs the most 

##### Democrats
mean(d$trumpapprove.change2[d$treatment=="media" & d$pid7<4], na.rm=T) #-.021
mean(d$trumpapprove.change2[d$treatment=="socialdem" & d$pid7<4], na.rm=T) # 0 
mean(d$trumpapprove.change2[d$treatment=="socialrep" & d$pid7<4], na.rm=T) # 0.11 *** Note larger change here
mean(d$trumpapprove.change2[d$treatment=="socialind" & d$pid7<4], na.rm=T) # .0588

##### Republicans
mean(d$trumpapprove.change2[d$treatment=="media" & d$pid7>4], na.rm=T) # .011
mean(d$trumpapprove.change2[d$treatment=="socialdem" & d$pid7>4], na.rm=T) # -.02 
mean(d$trumpapprove.change2[d$treatment=="socialrep" & d$pid7>4], na.rm=T) # 0.02
mean(d$trumpapprove.change2[d$treatment=="socialind" & d$pid7>4], na.rm=T) # .012

##### Independents
mean(d$trumpapprove.change2[d$treatment=="media" & d$pid7==4], na.rm=T) # .059
mean(d$trumpapprove.change2[d$treatment=="socialdem" & d$pid7==4], na.rm=T) # 0 
mean(d$trumpapprove.change2[d$treatment=="socialrep" & d$pid7==4], na.rm=T) # 0
mean(d$trumpapprove.change2[d$treatment=="socialind" & d$pid7==4], na.rm=T) # .067

### Baseline levels of (dis)approval among Democrats compared to post-treatment levels of (dis)approval among Democrats

prop.table(table(d$trumpapprove.pre2[d$pid7<4])) # baseline (all Democrats)
  # 74.2% disapprove strongly, 14.7% disapprove, 7.99% approve, 3.1% strongly approve 

prop.table(table(d$trumpapprove.pre2[d$pid7<4 & d$treatment=="socialrep"])) # baseline (Republican informant condition, but pre-treatment)
  # 73.5% disapprove strongly, 15.3% disapprove, 6.12% approve, 5.1% strongly approve 

prop.table(table(d$trumpapprove.post2[d$pid7<4 & d$treatment=="socialrep"]))
  # 68.4% disapprove strongly, 18.4% disapprove, 6.12% approve, 7.13% strongly approve 



